package StudyCode.summary.myfile;

import java.io.IOException;
import java.nio.file.*;
import java.util.EnumSet;

/**
 * 版权所有 科技与人文(www.tah1986.com)
 */
public class GelAllFilesByNIOSetMaxLevel {
	public static void main(String[] args) {
		Path listDir = Paths.get("E:\\CODE\\JAVA\\ReviewCode\\src\\StudyCode\\");
		ListTree1 walk = new ListTree1();
		EnumSet<FileVisitOption> opts = EnumSet.of(FileVisitOption.FOLLOW_LINKS);

		try {
			Files.walkFileTree(listDir, opts, Integer.MAX_VALUE, walk);
		} catch (IOException e) {
			System.err.println(e);
		}

	}
}

class ListTree1 extends SimpleFileVisitor<Path> {

	@Override
	public FileVisitResult postVisitDirectory(Path dir, IOException exc) {

		System.out.println(dir.toString());

		return FileVisitResult.CONTINUE;
	}

	@Override
	public FileVisitResult visitFileFailed(Path file, IOException exc) {
		System.out.println(exc);
		return FileVisitResult.CONTINUE;
	}
}
